package com.itheima.aimobile.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.aimobile.domain.PackageInfo;
import com.itheima.aimobile.mapper.PackageInfoMapper;
import com.itheima.aimobile.service.IPackageInfoService;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class PackageInfoServiceImpl extends ServiceImpl<PackageInfoMapper, PackageInfo> implements IPackageInfoService {

    @Override
    public List<PackageInfo> getPackagesByPriceRange(BigDecimal min, BigDecimal max) {
        QueryWrapper<PackageInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.between("monthly_rent", min, max); // 等价于 SQL: WHERE monthly_rent BETWEEN ? AND ?
        return baseMapper.selectList(queryWrapper);
    }
}
